<template>
  <div class="app-container">
    <table-list
      ref="tableList"
      :fields="tableDataColumn"
      :pagination="true"
      :searchFunc="realNameVerificationGetList"
      :searchDefault="searchConditions"
      border></table-list>
  </div>
</template>
<script>
import TableList from '@/components/TableList/index';
import Detail from '@/views/product/operator/realNameVerification/detail';
import { realNameVerificationGetList } from '@/api/product';
import { getList as getUserList } from '@/api/user';
export default {
  name: 'portraitComparison',
  components: {
    TableList,
  },
  props: {
    product: {
      type: Object,
      default: null,
    },
  },
  data() {
    return {
      realNameVerificationGetList,
    };
  },
  computed: {
    searchConditions() {
      return {
        product_no: this.product.product_no,
      };
    },
    showPhone() {
      if (this.product.product_no === 'P_E01_0005') {
        return false;
      }
      return true;
    },
    showIdCard() {
      if (this.product.product_no === 'P_002_0251') {
        return false;
      }
      return true;
    },
    showOperator() {
      if (['P_002_0102', 'P_002_0261', 'P_E01_0003', 'P_002_0251'].includes(this.product.product_no)) {
        return true;
      }
      return false;
    },
    showXhzw() {
      if (this.product.product_no === 'P_E01_0003') {
        return true;
      }
      return false;
    },
    tableDataColumn() {
      return [
        {
          prop: 'id',
          searchName: 'id',
          label: 'ID',
          minWidth: '60',
          searchType: 'input',
          exact: true,
        },
        {
          prop: 'name',
          searchName: 'name',
          label: '姓名',
          minWidth: '120',
          searchType: 'input',
          baseSeachColumn: true,
        },
        {
          prop: 'phone',
          searchName: 'phone',
          label: '手机号码',
          minWidth: '120',
          searchType: 'input',
          showField: this.showPhone,
        },
        {
          prop: 'id_card',
          searchName: 'id_card',
          label: '身份证',
          minWidth: '160',
          searchType: 'input',
          showField: this.showIdCard,
        },
        {
          prop: 'message',
          searchName: 'message',
          label: '查询结果',
          minWidth: '200',
          searchType: 'input',
        },
        {
          prop: 'origin_result',
          searchName: 'origin_result',
          label: '认证结果',
          minWidth: '220',
          searchType: 'input',
        },
        {
          prop: 'real_operator',
          searchName: 'real_operator',
          label: '运营商',
          minWidth: '120',
          searchType: 'input',
          showField: this.showOperator,
        },
        {
          prop: 'is_xhzw',
          searchName: 'is_xhzw',
          label: '携号转网',
          options: [
            {
              value: 1,
              label: '是',
              color: '#67C23A',
            },
            {
              value: 2,
              label: '否',
              color: '#F56C6C',
            },
          ],
          minWidth: '120',
          searchType: 'select',
          showField: this.showXhzw,
        },
        {
          prop: 'is_charge',
          searchName: 'is_charge',
          label: '计费',
          options: [
            {
              value: 1,
              label: '是',
              color: '#67C23A',
            },
            {
              value: 0,
              label: '否',
              color: '#F56C6C',
            },
          ],
          minWidth: '120',
          searchType: 'select',
        },
        {
          prop: 'rate',
          label: '费用',
          minWidth: '120',
        },
        {
          prop: 'user.nick_name',
          searchName: 'user_id',
          label: '用户',
          minWidth: '120',
          searchType: 'remoteSelect',
          searchAction: getUserList,
          searchKey: 'id',
          searchLabel: 'nick_name',
          exact: true,
        },
        {
          prop: 'created_at',
          searchName: 'created_at',
          label: '创建时间',
          minWidth: '180',
          searchType: 'dateTime',
        },
      ];
    },
  },
  methods: {},
};
</script>